package net.ib.mtalk.database.helper;

import net.ib.mtalk.database.DatabaseContract.ParticipantsTable;
import android.content.ContentValues;
import android.content.Context;

public class ParticipantsDatabaseHelper {
	public static void insert(Context context, int buddy_id, int group_id) {
		ContentValues cv = new ContentValues();
		cv.put(ParticipantsTable.KEY_PARTICIPANTS_GROUP, group_id);
		cv.put(ParticipantsTable.KEY_PARTICIPANTS_BUDDY, buddy_id);
		
		context.getContentResolver().insert(ParticipantsTable.CONTENT_URI, cv);
	}

	public static void delete(Context context, int buddy_id, int group_id) {
		String where = "(" + ParticipantsTable.KEY_PARTICIPANTS_GROUP + "=? AND " + ParticipantsTable.KEY_PARTICIPANTS_BUDDY + "=?)"; 
		String[] selectionArgs = {String.valueOf(group_id), String.valueOf(buddy_id)};
		context.getContentResolver().delete(ParticipantsTable.CONTENT_URI, where, selectionArgs);
	}
}
